package com.simon.OCP;

public class OCP {
    public static void main(String[] args) {
        GraphicEditor g = new GraphicEditor();
        g.drawShape(new Circle());
    }
}
class GraphicEditor{
    public void drawShape(Shape s){
        s.draw();
    }
}
abstract class Shape {
    public abstract void draw();
}

class Rectangle extends Shape {
    @Override
    public void draw() {
        System.out.println("绘矩形");
    }
}
class Circle extends Shape {
    @Override
    public void draw() {
        System.out.println("绘制圆形");
    }
}